package visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wcj
 * @Date 2021/7/12 20:34
 * @Version 1.0
 */
public class ObjectStruct {

    private List<Person> personList = new ArrayList<>();

    public void attach(Person person) {
        personList.add(person);
    }

    public void remove(Person person) {
        personList.remove(person);
    }

    public void visit(Visitor visitor) {
        for (Person person : personList) {
            person.accept(visitor);
        }
    }
}
